#include <iostream>
using namespace std;

namespace zzy
{
    typedef int Datetype;
    class stack
    {
    public:
        stack(size_t capcity = 10)
        {
            _arr = (Datetype*)malloc(capcity*sizeof(Datetype));
            if (nullptr == _arr)
            {
                perror("malloc fail");
                return;
            }
            _size = 0;
            _capcity = capcity;
        }

        void push(const Datetype& x)
        {
            _arr[_size] = x;
            _size++;
        }

        ~stack()
        {
            if(_arr)
            {
                free(_arr);
                _arr = nullptr;
                _capcity = 0;
                _size = 0;
            }
        }

    private:
        Datetype *_arr;
        size_t _size;
        size_t _capcity;
    };


}

int main()
{
    zzy::stack s1;
    s1.push(1);
    s1.push(2);
    s1.push(3);
    s1.push(4);

    zzy::stack s2(s1);

    return 0;
}
